home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / UPC12BS1.ZIP / UUCICO / DCPSYS.C < prev    next >
C/C++ Source or Header  |  1993-10-03  |  37KB  |  1,024 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    d c p s y s . c                                                 */
  3. /*                                                                    */
  4. /*    System support functions for UUCICO                             */
  5. /*                                                                    */
  6. /*    Changes Copyright (c) 1990-1993 by Kendra Electronic            */
  7. /*    Wonderworks.                                                    */
  8. /*                                                                    */
  9. /*    Changes Copyright (c) 1989 by Andrew H. Derbyshire.             */
  10. /*                                                                    */
  11. /*    All rights reserved except those explicitly granted by the      */
  12. /*    UUPC/extended license agreement.                                */
  13. /*                                                                    */
  14. /*    Copyright (c) Richard H. Lamb 1985, 1986, 1987                  */
  15. /*    Changes Copyright (c) Stuart Lynne 1987                         */
  16. /*                                                                    */
  17. /* Updated:                                                           */
  18. /*                                                                    */
  19. /*    13May89  - Modified checkname to only examine first token of    */
  20. /*               name.                                                */
  21. /*               Modified rmsg to initialize input character before   */
  22. /*               use.                                                 */
  23. /*    16May89  - Moved checkname to router.c - ahd                    */
  24. /*    17May89  - Wrote real checktime() - ahd                         */
  25. /*    17May89  - Changed getsystem to return 'I' instead of 'G'       */
  26. /*    25Jun89  - Added Reach-Out America to keyword table for         */
  27. /*               checktime                                            */
  28. /*    22Sep89  - Password file support for hosts                      */
  29. /*    25Sep89  - Change 'ExpectStr' message to debuglevel 2           */
  30. /*    01Jan90  - Revert 'ExpectStr' message to debuglevel 1           */
  31. /*    28Jan90  - Alter callup() to use table driven modem driver.     */
  32. /*               Add direct(), qx() procedures.                       */
  33. /*    8 Jul90  - Add John DuBois's expectstr() routine to fix         */
  34. /*               problems with long input buffers.                    */
  35. /*    11Nov90  - Delete QX support, add ddelay, ssleep calls          */
  36. /*    21Sep92  - Insure system system name and time do not crash      */
  37. /*               UUCICO - from the original fix by Eugene             */
  38. /*               Nesterenko, Moscow, Russia                           */
  39. /*--------------------------------------------------------------------*/
  40.  
  41. /*
  42.  *     $Id: dcpsys.c 1.24 1993/10/03 22:34:33 ahd Exp $
  43.  *
  44.  *     $Log: dcpsys.c $
  45.  * Revision 1.24  1993/10/03  22:34:33  ahd
  46.  * Alter format of numbers printed
  47.  *
  48.  * Revision 1.23  1993/09/29  04:52:03  ahd
  49.  * Use additional state in support of suspend port code
  50.  *
  51.  * Revision 1.22  1993/09/28  01:38:19  ahd
  52.  * Add configurable timeout for conversation start up phase
  53.  *
  54.  * Revision 1.21  1993/09/27  04:04:06  ahd
  55.  * Normalize references to modem speed to avoid incorrect displays
  56.  *
  57.  * Revision 1.20  1993/09/27  00:48:43  ahd
  58.  * Allow 't' protocol under 16 bit OS/2
  59.  *
  60.  * Revision 1.19  1993/09/21  01:42:13  ahd
  61.  * Move declare of protocol list into source from header
  62.  *
  63.  * Revision 1.18  1993/09/20  04:48:25  ahd
  64.  * TCP/IP support from Dave Watt
  65.  * 't' protocol support
  66.  * OS/2 2.x support (BC++ 1.0 for OS/2)
  67.  *
  68.  * Revision 1.17  1993/08/26  05:00:25  ahd
  69.  * Debugging code for odd failures on J. McBride's network
  70.  *
  71.  * Revision 1.16  1993/05/30  00:01:47  ahd
  72.  * Multiple commuications drivers support
  73.  *
  74.  * Revision 1.15  1993/05/09  03:41:47  ahd
  75.  * Make wmsg accept const string
  76.  * Make sending/receiving of -x string to/from remote UUCICO optional
  77.  * Delete rejection of high levels of debug for anonymous UUCICO's
  78.  *
  79.  * Revision 1.14  1993/05/06  03:41:48  ahd
  80.  * Save true host name of caller in hostp->via field for use by
  81.  * SYSLOG processing.
  82.  *
  83.  * Revision 1.13  1993/04/11  00:34:11  ahd
  84.  * Global edits for year, TEXT, etc.
  85.  *
  86.  * Revision 1.12  1993/04/05  04:35:40  ahd
  87.  * Add timestamp, file size to directory information
  88.  *
  89.  * Revision 1.11  1993/01/23  19:08:09  ahd
  90.  * Don't update system stats in sysend()
  91.  *
  92.  * Revision 1.10  1992/12/11  12:45:11  ahd
  93.  * Shorten remote display to improve OS/2 windowed scrolling
  94.  *
  95.  * Revision 1.9  1992/12/01  04:37:03  ahd
  96.  * Modify *nbstime call restrictions to make it less agressive
  97.  *
  98.  * Revision 1.8  1992/11/22  21:20:45  ahd
  99.  * Use strpool for const string allocation
  100.  *
  101.  * Revision 1.7  1992/11/21  06:17:08  ahd
  102.  * Transmit only one character in response to P (protocol) request
  103.  *
  104.  * Revision 1.6  1992/11/19  03:00:51  ahd
  105.  * drop rcsid
  106.  *
  107.  * Revision 1.5  1992/11/18  03:49:21  ahd
  108.  * Move check of call window to avoid premature lock file overhead
  109.  *
  110.  * Revision 1.4  1992/11/17  13:46:42  ahd
  111.  * If host lookup fails, issue real error message, not malloc failure!
  112.  *
  113.  * Revision 1.3  1992/11/16  02:14:17  ahd
  114.  * Initialize previous directory scanned variable in scandir
  115.  *
  116.  * Revision 1.2  1992/11/15  20:11:07  ahd
  117.  * Clean up modem file support for different protocols
  118.  *
  119.  */
  120.  
  121. /*--------------------------------------------------------------------*/
  122. /*                        system include files                        */
  123. /*--------------------------------------------------------------------*/
  124.  
  125. #include <stdio.h>
  126. #include <stdlib.h>
  127. #include <string.h>
  128. #include <time.h>
  129. #include <ctype.h>
  130.  
  131. /*--------------------------------------------------------------------*/
  132. /*                    UUPC/extended include files                     */
  133. /*--------------------------------------------------------------------*/
  134.  
  135. #include "lib.h"
  136. #include "arpadate.h"
  137. #include "checktim.h"
  138. #include "dcp.h"
  139. #include "dcpfpkt.h"
  140. #include "dcpgpkt.h"
  141. #include "dcptpkt.h"
  142. #include "dcplib.h"
  143. #include "dcpsys.h"
  144. #include "export.h"
  145. #include "hlib.h"
  146. #include "hostable.h"
  147. #include "hostatus.h"
  148. #include "modem.h"
  149. #include "lock.h"
  150. #include "nbstime.h"
  151. #include "uundir.h"
  152. #include "ssleep.h"
  153. #include "security.h"
  154. #include "commlib.h"
  155.  
  156. currentfile();
  157.  
  158. /*--------------------------------------------------------------------*/
  159. /*                     Define available protocols                     */
  160. /*--------------------------------------------------------------------*/
  161.  
  162. typedef struct {
  163.         char type;
  164.         procref getpkt, sendpkt, openpk, closepk, rdmsg, wrmsg, eofpkt,
  165.                   filepkt;
  166.         boolean network;
  167. } Proto;
  168.  
  169. Proto Protolst[] = {
  170.        { 'g', ggetpkt, gsendpkt, gopenpk, gclosepk,
  171.               grdmsg,  gwrmsg,   geofpkt, gfilepkt,
  172.               FALSE,
  173.        } ,
  174.  
  175.        { 'G', ggetpkt, gsendpkt, Gopenpk, gclosepk,
  176.               grdmsg,  gwrmsg,   geofpkt, gfilepkt,
  177.               FALSE,
  178.        } ,
  179.  
  180.        { 'f', fgetpkt, fsendpkt, fopenpk, fclosepk,
  181.               frdmsg,  fwrmsg,   feofpkt, ffilepkt,
  182.               FALSE,
  183.        } ,
  184.  
  185.        { 'v', ggetpkt, gsendpkt, vopenpk, gclosepk,
  186.               grdmsg,  gwrmsg,   geofpkt, gfilepkt,
  187.               FALSE,
  188.        } ,
  189. #if defined(_Windows) || defined(BIT32ENV) || defined(FAMILYAPI)
  190.        { 't', tgetpkt, tsendpkt, topenpk, tclosepk,
  191.               grdmsg,  gwrmsg,   geofpkt, gfilepkt, // Yup, same as 'g'
  192.               TRUE,
  193.        } ,
  194. #endif
  195.    { '\0' }
  196.    };
  197.  
  198. procref  getpkt, sendpkt, openpk, closepk, rdmsg, wrmsg, eofpkt, filepkt;
  199.  
  200. char *flds[60];
  201. int kflds;
  202. static char protocols[5];
  203. static char S_sysline[BUFSIZ];
  204.  
  205. static void setproto(char wanted);
  206.  
  207. static char HostGrade( const char *fname, const char *remote );
  208.  
  209. /****************************************/
  210. /*              Sub Systems             */
  211. /****************************************/
  212.  
  213. /*-----------